#define _CRT_SECURE_NO_WARNINGS 1
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 10010;

int a[110];
bool f[N];

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

int main()
{
    int n;
    scanf("%d", &n);
    int d = 0;
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        d = gcd(d, a[i]);
    }

    if (d != 1) puts("INF");
    else
    {
        f[0] = true;
        for (int i = 1; i <= n; i++)
            for (int j = a[i]; j < N; j++)
                f[j] |= f[j - a[i]];

        int res = 0;
        for (int i = 0; i < N; i++)
            if (!f[i])
                res++;

        printf("%d\n", res);
    }

    return 0;
}
